package com.cy.pj.sys.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cy.pj.common.bo.PageObject;
import com.cy.pj.common.vo.JsonResult;
import com.cy.pj.sys.entity.SysLog;
import com.cy.pj.sys.service.SysLogService;

@Controller
@RequestMapping("/log/")
public class SysLogController {
	@Autowired
	private SysLogService sysLogService;
	@RequestMapping("doFindPageObjects")
	@ResponseBody
	public JsonResult doFindPageObjects(String username,Integer pageCurrent) {
		
			PageObject<SysLog> pageObject = sysLogService.findPageObjects(username, pageCurrent);
		
		
		return new JsonResult(pageObject);
	}
//	/**局部的
//	 * @exceptionHandler 注解描述的方法为控制层的异常处理方法,此注解
//	 * 中传入的异常类型,为他描述的方法可以处理异常
//	 * @param e
//	 * @return
//	 */
//	@ExceptionHandler(RuntimeException.class)
//	@ResponseBody
//	public JsonResult doHandleRuntimeException(RuntimeException e) {
//		e.printStackTrace();
//		
//		return new JsonResult(e);
//	}
	@ResponseBody
	@RequestMapping("doDeleteObjects")
	public JsonResult doDeleteObjects(Integer... ids) {
		sysLogService.deleteObjects(ids);
		
		
		return new JsonResult("delete ok");
		
	}
}
